package com.subnext.news.model;

import com.google.appengine.api.datastore.Entity;
import com.subnext.model.BaseEntity;
import static com.subnext.utils.EntityUtil.setProperty;
import static com.subnext.utils.EntityUtil.getLongProperty;
import static com.subnext.utils.EntityUtil.getStringProperty;

public class NewsEntity extends BaseEntity {
	
	private static final long serialVersionUID = 1L;
	private String headline;
	private String body;
	private Long categoryId;
	
	
	@Override
	public void load(Entity entity) {
		super.load(entity);
		headline = getStringProperty(entity, "headline");
		body = getStringProperty(entity, "body");
		categoryId = getLongProperty(entity, "categoryId");
	}
	@Override
	public void save(Entity entity) {
		super.save(entity);
		setProperty(entity, "headline", headline, false);
		setProperty(entity, "body", body, false);
		setProperty(entity, "categoryId", categoryId, false);
	}
	
	public String getHeadline() {
		return headline;
	}
	public void setHeadline(String headline) {
		this.headline = headline;
	}
	public String getBody() {
		return body;
	}
	public void setBody(String body) {
		this.body = body;
	}
	public Long getCategoryId() {
		return categoryId;
	}
	public void setCategoryId(Long categoryId) {
		this.categoryId = categoryId;
	}
	
	
}
